package jp.sourceforge.akjrcp.shared;

import jp.sourceforge.akjrcp.ffmpeg.FFMpegUI;
import jp.sourceforge.akjrcp.util.AvisynthUtils;
import jp.sourceforge.akjrcp.util.DefaultSetter;
import jp.sourceforge.akjrcp.util.YoutubeDLUtils;

import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.PlatformUI;

public class PublicPreferenceInitializer extends AbstractPreferenceInitializer{

	@Override
	public void initializeDefaultPreferences() {
		try{
		IPreferenceStore publicStore=PlatformUI.getPreferenceStore();
		
		publicStore.setDefault(AvisynthUtils.USE_AVISOURCE, true);
		publicStore.setDefault(AvisynthUtils.WMV_FPS, "29.97");
		
		DefaultSetter.setFilePath(publicStore,FFMpegUI.FFMPEG_PATH,DefaultSetter.toInstalledDirectory(new String[]{"ffmpeg\\ffmpeg.exe","ffmpeg\\bin\\ffmpeg.exe","bin\\ffmpeg.exe"},
				new String[]{"C:\\Program Files\\MediaCoder\\codecs\\ffmpeg.exe"}));
		
	
		
		
//		pure_ffmpeg.exe
		DefaultSetter.setFilePath(publicStore,FFMpegUI.PURE_FFMPEG_PATH,DefaultSetter.toInstalledDirectory(new String[]{"bin\\pure_ffmpeg.exe"},new String[]{
		})
		);
		
		//Youtube DL
		DefaultSetter.setFilePath(publicStore,YoutubeDLUtils.PATH_PYTHON,new String[]{
				"c:\\python26\\python.exe",
				"c:\\python25\\python.exe",
				"c:\\python24\\python.exe"
		});
		
		DefaultSetter.setFilePath(publicStore,YoutubeDLUtils.PATH_YOUTUBE_DL_PY,DefaultSetter.toInstalledDirectory(new String[]{"youtube-dl.py"},new String[]{}));

		DefaultSetter.setFilePath(publicStore,YoutubeDLUtils.PATH_YOUTUBE_DL_EXE,DefaultSetter.toInstalledDirectory(new String[]{"bin\\youtube-dl.exe"},new String[]{}));
		
		
		publicStore.setDefault(YoutubeDLUtils.DOWNLOAD_FORMAT, YoutubeDLUtils.fmts[3]);
		
		publicStore.setDefault(FFMpegUI.USE_PURE_FFMPEG,false);//
		publicStore.setDefault(FFMpegUI.DEMUX_SOME_VIDEO, false);
		publicStore.setDefault(FFMpegUI.ALERT_PTHREAD, false);
		}catch(Exception e){
			e.printStackTrace();
		}
	}

}
